package com.wdhcr.controller.admin;

import com.wdhcr.enums.ResultCode;
import com.wdhcr.service.LogService;
import com.wdhcr.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class LogController {

    @Autowired
    private LogService logService;

    @CrossOrigin
    @GetMapping("/getLog")
    public ResponseResult getLog(){
        System.out.println("日志");
        List logAll = logService.findAll();

        if (logAll != null){
            return new ResponseResult(ResultCode.SUCCESS.getCode(),"请求成功！",logAll);
        }
        return new ResponseResult(ResultCode.FAIL.getCode(),"请求失败！",null);
    }
}
